package com.maizhi.util;

import java.io.File;
import java.util.List;

import com.sina.sae.storage.SaeStorage;

public class StorageDemo {
	
	

	public static void main(String[] args){
		
		String accessKey = "n1033moxlo";
		String secretKey = "x5j3ijk5k20j5wzyljm2i35i2xyik2x05ji5m1kl";
		String appName   = "zuilishui";
		String seaTempPath="file";
		
		String domain    = "lee";
		
		byte[] bytes = new byte[1024 * 1024];//从请求中取得文件二进制流
		SaeStorage storage = new SaeStorage(accessKey,secretKey,appName);
		System.out.println("accessKey :"+accessKey);
		System.out.println("secretKey :"+secretKey);
		System.out.println("appName :"+appName);
		System.out.println("seaTempPath :"+seaTempPath);
		
		File file = new File("d:\\wx_config.sql");

		storage.write(domain , "wx_config.sql" ,bytes);
		
		List list = storage.getList(domain);
		if(list!=null && list.size()>0){
			for(int i=0;i<list.size();i++){
				System.out.println(" i : "+i+ "  : "+list.get(i));
			}
		}
		
		storage.upload(domain, "wx_config.sql", file.getName());
	}
}
